﻿using OctoOS.UI;
using System.Web.UI.HtmlControls;
using System;
using System.Web;

/// <summary>
/// Summary description for SectionUIPreview
/// </summary>
public class SectionUIPreview : ObjectPreview
{
	public SectionUIPreview(long articleID, long pageID, Section section, string name)
	{
		HeaderText = section.Title == "" ? "section title" : section.Title;
		HeaderUrl = Urls.GetArticle(articleID, true, false, pageID, name) 
			+ "#s" + section.ID;
		Body = new Literal(Resources.Main.shared_Format + ": " + section.Format);
		var deleteLink = new HtmlAnchor()
		{
			ID = articleID + "_" + pageID +"_"+ section.ID +"_"+
				HttpUtility.JavaScriptStringEncode(section.Title),
			InnerText = Resources.Main.shared_Delete,
			//HRef = String.Format("javascript:myApp.deleteSection('{0}', '{1}', '{2}', '{3}')", 
			//    articleID, pageID, section.ID, 
			//    HttpUtility.JavaScriptStringEncode(section.Title))// Urls.GetDeleteSection(articleID, pageID, section.ID)
		};
		deleteLink.Attributes.Add("class", "deleteSectionLink");
		Footer = deleteLink;
	}
}